home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #3 / Amiga Plus CD - 2002 - No. 03.iso / AmigaPlus / Tools / Development / renderlib40 / src / lib_init_mos.c < prev    next >
Encoding:
C/C++ Source or Header  |  2003-01-27  |  15.2 KB  |  658 lines

  1.  
  2. #include "lib_init.h"
  3. #include "lib_debug.h"
  4. #include <proto/exec.h>
  5.  
  6. #define AQuote(string) #string
  7. #define AVersion(major,minor) AQuote(major ## . ## minor)
  8. #define AmVersion(major,minor) AVersion(major,minor)
  9. #define LIBVER AmVersion(LIB_VERSION,LIB_REVISION)
  10. #define LIBTYPE " [MorphOS]"
  11.  
  12. static LONG LibNull(void)
  13. {
  14.     return -1;
  15. }
  16.  
  17. static char LibVersion[] = "$VER: " LIB_NAME " " LIBVER " " LIB_DATE LIBTYPE;
  18.  
  19. static struct LibInitStruct
  20. {
  21.     ULONG LibSize;
  22.     void *FuncTable;
  23.     void *DataTable;
  24.     void (*InitFunc)(void);
  25.  
  26. } LibInitStruct;
  27.  
  28. struct Resident RomTag = 
  29. {
  30.     RTC_MATCHWORD,
  31.     &RomTag,
  32.     &RomTag + 1,
  33.     RTF_AUTOINIT | RTF_PPC | RTF_EXTENDED,
  34.     LIB_VERSION,
  35.     NT_LIBRARY,
  36.     0,
  37.     LIB_NAME,
  38.     &LibVersion[6],
  39.     &LibInitStruct,
  40.     LIB_REVISION,
  41.     NULL
  42. };
  43.  
  44. ULONG __abox__ = 1;
  45.  
  46. struct ExecBase *SysBase = NULL;
  47.  
  48. /*****************************************************************************
  49. **
  50. **    lib function wrappers.
  51. */
  52.  
  53. static APTR libCreateRMHandlerA(void)
  54. {
  55.     struct TagItem *tags = (struct TagItem *)REG_A1;
  56.     return CreateRMHandlerA(tags);
  57. }
  58.  
  59. static void libDeleteRMHandler(void)
  60. {
  61.     APTR rmh = (APTR)REG_A0;
  62.     DeleteRMHandler(rmh);
  63. }
  64.  
  65. static APTR libAllocRenderMem(void)
  66. {
  67.     APTR rmh = (APTR)REG_A0;
  68.     ULONG size = (ULONG)REG_D0;
  69.     return AllocRenderMem(rmh, size);
  70. }
  71.  
  72. static void libFreeRenderMem(void)
  73. {
  74.     APTR rmh = (APTR)REG_A0;
  75.     APTR mem = (APTR)REG_A1;
  76.     ULONG size = (ULONG)REG_D0;
  77.     FreeRenderMem(rmh, mem, size);
  78. }
  79.  
  80. static APTR libAllocRenderVec(void)
  81. {
  82.     APTR rmh = (APTR)REG_A0;
  83.     ULONG size = (ULONG)REG_D0;
  84.     return AllocRenderVec(rmh, size);
  85. }
  86.  
  87. static void libFreeRenderVec(void)
  88. {
  89.     APTR mem = (APTR)REG_A0;
  90.     FreeRenderVec(mem);
  91. }
  92.  
  93. static APTR libAllocRenderVecClear(void)
  94. {
  95.     APTR rmh = (APTR)REG_A0;
  96.     ULONG size = (ULONG)REG_D0;
  97.     return AllocRenderVecClear(rmh, size);
  98. }
  99.  
  100. static void libTurboFillMem(void)
  101. {
  102.     APTR mem = (APTR)REG_A0;
  103.     ULONG len = (ULONG)REG_D0;
  104.     ULONG val = (ULONG)REG_D1;
  105.     TurboFillMem(mem, len, val);
  106. }
  107.  
  108. static void libTurboCopyMem(void)
  109. {
  110.     APTR src = (APTR)REG_A0;
  111.     APTR dst = (APTR)REG_A1;
  112.     ULONG len = (ULONG)REG_D0;
  113.     TurboCopyMem(src, dst, len);
  114. }
  115.  
  116. static APTR libCreateHistogramA(void)
  117. {
  118.     struct TagItem *tags = (struct TagItem *)REG_A1;
  119.     return CreateHistogramA(tags);
  120. }
  121.  
  122. static void libDeleteHistogram(void)
  123. {
  124.     APTR histo = (APTR)REG_A0;
  125.     DeleteHistogram(histo);
  126. }
  127.  
  128. static ULONG libAddRGB(void)
  129. {
  130.     APTR histo = (APTR)REG_A0;
  131.     ULONG rgb = (ULONG)REG_D0;
  132.     ULONG count = (ULONG)REG_D1;
  133.     return AddRGB(histo, rgb, count);
  134. }
  135.  
  136. static ULONG libQueryHistogram(void)
  137. {
  138.     APTR histo = (APTR)REG_A0;
  139.     Tag tag = (Tag)REG_D0;
  140.     return QueryHistogram(histo, tag);
  141. }
  142.  
  143. static ULONG libAddRGBImageA(void)
  144. {
  145.     APTR histo = (APTR)REG_A0;
  146.     ULONG *rgb = (ULONG *)REG_A1;
  147.     UWORD width = (UWORD)REG_D0;
  148.     UWORD height = (UWORD)REG_D1;
  149.     struct TagItem *tags = (struct TagItem *)REG_A2;
  150.     return AddRGBImageA(histo, rgb, width, height, tags);
  151. }
  152.  
  153. static RNDPAL *libCreatePaletteA(void)
  154. {
  155.     struct TagItem *tags = (struct TagItem *)REG_A1;
  156.     return CreatePaletteA(tags);
  157. }
  158.  
  159. static void libDeletePalette(void)
  160. {
  161.     RNDPAL *palette = (RNDPAL *)REG_A0;
  162.     DeletePalette(palette);
  163. }
  164.  
  165. static void libImportPaletteA(void)
  166. {
  167.     RNDPAL *palette = (RNDPAL *)REG_A0;
  168.     APTR coltab = (APTR)REG_A1;
  169.     UWORD numcol = (UWORD)REG_D0;
  170.     struct TagItem *tags = (struct TagItem *)REG_A2;
  171.     ImportPaletteA(palette, coltab, numcol, tags);
  172. }
  173.  
  174. static void libExportPaletteA(void)
  175. {
  176.     RNDPAL *palette = (RNDPAL *)REG_A0;
  177.     APTR coltab = (APTR)REG_A1;
  178.     struct TagItem *tags = (struct TagItem *)REG_A2;
  179.     ExportPaletteA(palette, coltab, tags);
  180. }
  181.  
  182. static void libFlushPalette(void)
  183. {
  184.     RNDPAL *palette = (RNDPAL *)REG_A0;
  185.     FlushPalette(palette);
  186. }
  187.  
  188. static ULONG libAddChunkyImageA(void)
  189. {
  190.     RNDHISTO *histogram = (RNDHISTO *)REG_A0;
  191.     UBYTE *chunky = (UBYTE *)REG_A1;
  192.     UWORD width = (UWORD)REG_D0;
  193.     UWORD height = (UWORD)REG_D1;
  194.     RNDPAL *palette = (RNDPAL *)REG_A2;
  195.     struct TagItem *tags = (struct TagItem *)REG_A3;
  196.     return AddChunkyImageA(histogram, chunky, width, height, palette, tags);
  197. }
  198.  
  199. static ULONG libExtractPaletteA(void)
  200. {
  201.     RNDHISTO *histogram = (RNDHISTO *)REG_A0;
  202.     RNDPAL *palette = (RNDPAL *)REG_A1;
  203.     UWORD numcol = (UWORD)REG_D0;
  204.     struct TagItem *tags = (struct TagItem *)REG_A2;
  205.     return ExtractPaletteA(histogram, palette, numcol, tags);
  206. }
  207.  
  208. static struct RNDHistoEntry **libCreateHistogramPointerArray(void)
  209. {
  210.     RNDHISTO *histogram = (RNDHISTO *)REG_A0;
  211.     return CreateHistogramPointerArray(histogram);
  212. }
  213.  
  214. static ULONG libCountRGB(void)
  215. {
  216.     RNDHISTO *histogram = (RNDHISTO *)REG_A0;
  217.     ULONG rgb = (ULONG)REG_D0;
  218.     return CountRGB(histogram, rgb);
  219. }
  220.  
  221. static LONG libBestPen(void)
  222. {
  223.     RNDPAL *palette = (RNDPAL *)REG_A0;
  224.     ULONG rgb = (ULONG)REG_D0;
  225.     return BestPen(palette, rgb);
  226. }
  227.  
  228. static RNDMAP *libCreateMapEngineA(void)
  229. {
  230.     RNDPAL *palette = (RNDPAL *)REG_A0;
  231.     struct TagItem *tags = (struct TagItem *)REG_A1;
  232.     return CreateMapEngineA(palette, tags);
  233. }
  234.  
  235. static void libDeleteMapEngine(void)
  236. {
  237.     RNDMAP *mapengine = (RNDMAP *)REG_A0;
  238.     DeleteMapEngine(mapengine);
  239. }
  240.  
  241. static ULONG libMapRGBArrayA(void)
  242. {
  243.     RNDMAP *engine = (RNDMAP *)REG_A0;
  244.     ULONG *rgb = (ULONG *)REG_A1;
  245.     UWORD width = (UWORD)REG_D0;
  246.     UWORD height = (UWORD)REG_D1;
  247.     UBYTE *chunky = (UBYTE *)REG_A2;
  248.     struct TagItem *tags = (struct TagItem *)REG_A3;
  249.     return MapRGBArrayA(engine, rgb, width, height, chunky, tags);
  250. }
  251.  
  252. static ULONG libMapChunkyArrayA(void)
  253. {
  254.     RNDMAP *engine = (RNDMAP *)REG_A0;
  255.     UBYTE *src = (UBYTE *)REG_A1;
  256.     RNDPAL *palette = (RNDPAL *)REG_A2;
  257.     UWORD width = (UWORD)REG_D0;
  258.     UWORD height = (UWORD)REG_D1;
  259.     UBYTE *dest = (UBYTE *)REG_A3;
  260.     struct TagItem *tags = (struct TagItem *)REG_A4;
  261.     return MapChunkyArrayA(engine, src, palette, width, height, dest, tags);
  262. }
  263.  
  264. static ULONG libCountHistogram(void)
  265. {
  266.     RNDHISTO *histo = (RNDHISTO *)REG_A0;
  267.     return CountHistogram(histo);
  268. }
  269.  
  270. static ULONG libAddHistogramA(void)
  271. {
  272.     RNDHISTO *dst = (RNDHISTO *)REG_A0;
  273.     RNDHISTO *src = (RNDHISTO *)REG_A1;
  274.     struct TagItem *tags = (struct TagItem *)REG_A2;
  275.     return AddHistogramA(dst, src, tags);
  276. }
  277.  
  278. static ULONG libChunky2RGBA(void)
  279. {
  280.     UBYTE *src = (UBYTE *)REG_A0;
  281.     UWORD width = (UWORD)REG_D0;
  282.     UWORD height = (UWORD)REG_D1;
  283.     ULONG *dst = (ULONG *)REG_A1;
  284.     RNDPAL *pal = (RNDPAL *)REG_A2;
  285.     struct TagItem *tags = (struct TagItem *)REG_A3;
  286.     return Chunky2RGBA(src, width, height, dst, pal, tags);
  287. }
  288.  
  289. static LONG libRGBArrayDiversityA(void)
  290. {
  291.     ULONG *rgb = (ULONG *)REG_A0;
  292.     UWORD width = (UWORD)REG_D0;
  293.     UWORD height = (UWORD)REG_D1;
  294.     struct TagItem *tags = (struct TagItem *)REG_A1;
  295.     return RGBArrayDiversityA(rgb, width, height, tags);
  296. }
  297.  
  298. static LONG libChunkyArrayDiversityA(void)
  299. {
  300.     UBYTE *chunky = (UBYTE *)REG_A0;
  301.     RNDPAL *palette = (RNDPAL *)REG_A1;
  302.     UWORD width = (UWORD)REG_D0;
  303.     UWORD height = (UWORD)REG_D1;
  304.     struct TagItem *tags = (struct TagItem *)REG_A2;
  305.     return ChunkyArrayDiversityA(chunky, palette, width, height, tags);
  306. }
  307.  
  308. static void libInsertAlphaChannelA(void)
  309. {
  310.     UBYTE *chunky = (UBYTE *)REG_A0;
  311.     UWORD width = (UWORD)REG_D0;
  312.     UWORD height = (UWORD)REG_D1;
  313.     ULONG *rgb = (ULONG *)REG_A1;
  314.     struct TagItem *tags = (struct TagItem *)REG_A2;
  315.     InsertAlphaChannelA(chunky, width, height, rgb, tags);
  316. }
  317.  
  318. static void libExtractAlphaChannelA(void)
  319. {
  320.     ULONG *rgb = (ULONG *)REG_A0;
  321.     UWORD width = (UWORD)REG_D0;
  322.     UWORD height = (UWORD)REG_D1;
  323.     UBYTE *chunky = (UBYTE *)REG_A1;
  324.     struct TagItem *tags = (struct TagItem *)REG_A2;
  325.     ExtractAlphaChannelA(rgb, width, height, chunky, tags);
  326. }
  327.  
  328. static void libApplyAlphaChannelA(void)
  329. {
  330.     ULONG *src = (ULONG *)REG_A0;
  331.     UWORD width = (UWORD)REG_D0;
  332.     UWORD height = (UWORD)REG_D1;
  333.     ULONG *dst = (ULONG *)REG_A1;
  334.     struct TagItem *tags = (struct TagItem *)REG_A2;
  335.     ApplyAlphaChannelA(src, width, height, dst, tags);
  336. }
  337.  
  338. static void libMixRGBArrayA(void)
  339. {
  340.     ULONG *src = (ULONG *)REG_A0;
  341.     UWORD width = (UWORD)REG_D0;
  342.     UWORD height = (UWORD)REG_D1;
  343.     ULONG *dst = (ULONG *)REG_A1;
  344.     UWORD ratio = (UWORD)REG_D2;
  345.     struct TagItem *tags = (struct TagItem *)REG_A2;
  346.     MixRGBArrayA(src, width, height, dst, ratio, tags);
  347. }
  348.  
  349. static void libCreateAlphaArrayA(void)
  350. {
  351.     ULONG *rgb = (ULONG *)REG_A0;
  352.     UWORD width = (UWORD)REG_D0;
  353.     UWORD height = (UWORD)REG_D1;
  354.     struct TagItem *tags = (struct TagItem *)REG_A1;
  355.     CreateAlphaArrayA(rgb, width, height, tags);
  356. }
  357.  
  358. static void libMixAlphaChannelA(void)
  359. {
  360.     ULONG *rgb1 = (ULONG *)REG_A0;
  361.     ULONG *rgb2 = (ULONG *)REG_A1;
  362.     UWORD width = (UWORD)REG_D0;
  363.     UWORD height = (UWORD)REG_D1;
  364.     ULONG *dest = (ULONG *)REG_A2;
  365.     struct TagItem *tags = (struct TagItem *)REG_A3;
  366.     MixAlphaChannelA(rgb1, rgb2, width, height, dest, tags);
  367. }
  368.  
  369. static void libTintRGBArrayA(void)
  370. {
  371.     ULONG *src = (ULONG *)REG_A0;
  372.     UWORD width = (UWORD)REG_D0;
  373.     UWORD height = (UWORD)REG_D1;
  374.     ULONG rgb = (ULONG)REG_D2;
  375.     UWORD ratio = (UWORD)REG_D3;
  376.     ULONG *dest = (ULONG *)REG_A1;
  377.     struct TagItem *tags = (struct TagItem *)REG_A2;
  378.     TintRGBArrayA(src, width, height, rgb, ratio, dest, tags);
  379. }
  380.  
  381. static ULONG libSortPaletteA(void)
  382. {
  383.     RNDPAL *palette = (RNDPAL *)REG_A0;
  384.     ULONG mode = (ULONG)REG_D0;
  385.     struct TagItem *tags = (struct TagItem *)REG_A1;
  386.     return SortPaletteA(palette, mode, tags);
  387. }
  388.  
  389. static ULONG libRenderA(void)
  390. {
  391.     ULONG *src = (ULONG *)REG_A0;
  392.     UWORD width = (UWORD)REG_D0;
  393.     UWORD height = (UWORD)REG_D1;
  394.     UBYTE *dst = (UBYTE *)REG_A1;
  395.     RNDPAL *palette = (RNDPAL *)REG_A2;
  396.     struct TagItem *tags = (struct TagItem *)REG_A3;
  397.     return RenderA(src, width, height, dst, palette, tags);
  398. }
  399.  
  400.  
  401. static void libPlanar2ChunkyA(void)
  402. {
  403.     UWORD **planetab = (UWORD **)REG_A0;
  404.     UWORD bytewidth = (UWORD)REG_D0;
  405.     UWORD rows = (UWORD)REG_D1;
  406.     UWORD depth = (UWORD)REG_D2;
  407.     UWORD bytesperrow = (UWORD)REG_D3;
  408.     UBYTE *dst = (UBYTE *)REG_A1;
  409.     struct TagItem *tags = (struct TagItem *)REG_A2;
  410.     Planar2ChunkyA(planetab, bytewidth, rows, depth, bytesperrow, dst, tags);
  411. }
  412.  
  413. static void libChunky2BitMapA(void)
  414. {
  415.     UBYTE *src = (UBYTE *)REG_A0;
  416.     UWORD sx = (UWORD)REG_D0;
  417.     UWORD sy = (UWORD)REG_D1;
  418.     UWORD width = (UWORD)REG_D2;
  419.     UWORD height = (UWORD)REG_D3;
  420.     struct BitMap *bm = (struct BitMap *)REG_A1;
  421.     UWORD dx = (UWORD)REG_D4;
  422.     UWORD dy = (UWORD)REG_D5;
  423.     struct TagItem *tags = (struct TagItem *)REG_A2;
  424.     Chunky2BitMapA(src, sx, sy, width, height, bm, dx, dy, tags);
  425. }
  426.  
  427. static ULONG libGetPaletteAttrs(void)
  428. {
  429.     RNDPAL *pal = (RNDPAL *)REG_A0;
  430.     ULONG args = (ULONG)REG_D0;
  431.     return GetPaletteAttrs(pal, args);
  432. }
  433.  
  434. static void libRemapArrayA(void)
  435. {
  436.     UBYTE *src = (UBYTE *)REG_A0;
  437.     UWORD width = (UWORD)REG_D0;
  438.     UWORD height = (UWORD)REG_D1;
  439.     UBYTE *dst = (UBYTE *)REG_A1;
  440.     UBYTE *pentab = (UBYTE *)REG_A2;
  441.     struct TagItem *tags = (struct TagItem *)REG_A3;
  442.     RemapArrayA(src, width, height, dst, pentab, tags);
  443. }
  444.  
  445. static ULONG libConvertChunkyA(void)
  446. {
  447.     UBYTE *src = (UBYTE *)REG_A0;
  448.     RNDPAL *srcpal = (RNDPAL *)REG_A1;
  449.     UWORD width = (UWORD)REG_D0;
  450.     UWORD height = (UWORD)REG_D1;
  451.     UBYTE *dst = (UBYTE *)REG_A2;
  452.     RNDPAL *dstpal = (RNDPAL *)REG_A3;
  453.     struct TagItem *tags = (struct TagItem *)REG_A4;
  454.     return ConvertChunkyA(src, srcpal, width, height, dst, dstpal, tags);
  455. }
  456.  
  457. static void libCreatePenTableA(void)
  458. {
  459.     UBYTE *src = (UBYTE *)REG_A0;
  460.     RNDPAL *srcpal = (RNDPAL *)REG_A1;
  461.     UWORD width = (UWORD)REG_D0;
  462.     UWORD height = (UWORD)REG_D1;
  463.     RNDPAL *newpal = (RNDPAL *)REG_A2;
  464.     UBYTE *pentab = (UBYTE *)REG_A3;
  465.     struct TagItem *tags = (struct TagItem *)REG_A4;
  466.     CreatePenTableA(src, srcpal, width, height, newpal, pentab, tags);
  467. }
  468.  
  469. static RNDSCALE *libCreateScaleEngineA(void)
  470. {
  471.     UWORD sw = (UWORD)REG_D0;
  472.     UWORD sh = (UWORD)REG_D1;
  473.     UWORD dw = (UWORD)REG_D2;
  474.     UWORD dh = (UWORD)REG_D3;
  475.     struct TagItem *tags = (struct TagItem *)REG_A1;
  476.     return CreateScaleEngineA(sw, sh, dw, dh, tags);
  477. }
  478.  
  479. static void libDeleteScaleEngine(void)
  480. {
  481.     RNDSCALE *sce = (RNDSCALE *)REG_A0;
  482.     DeleteScaleEngine(sce);
  483. }
  484.  
  485. static ULONG libScaleA(void)
  486. {
  487.     RNDSCALE *sce = (RNDSCALE *)REG_A0;
  488.     APTR src = (APTR)REG_A1;
  489.     APTR dst = (APTR)REG_A2;
  490.     struct TagItem *tags = (struct TagItem *)REG_A3;
  491.     return ScaleA(sce, src, dst, tags);
  492. }
  493.  
  494. static UWORD libScaleOrdinate(void)
  495. {
  496.     UWORD start = (UWORD)REG_D0;
  497.     UWORD dest = (UWORD)REG_D1;
  498.     UWORD ordinate = (UWORD)REG_D2;
  499.     return ScaleOrdinate(start, dest, ordinate);
  500. }
  501.  
  502.  
  503.  
  504. /*****************************************************************************
  505. **
  506. **    lib setup
  507. */
  508.  
  509. #define SysBase LibBase->ExecBase
  510.  
  511. static LIB_BASE_T *LibOpen(void)
  512. {
  513.     LIB_BASE_T *LibBase = (LIB_BASE_T *) REG_A6;
  514.     LIB_BASE_T *result = LibBase;
  515.     ObtainSemaphore(&LibBase->LockSemaphore);
  516.     LibBase->LibNode.lib_Flags &= ~LIBF_DELEXP;
  517.     if (++LibBase->LibNode.lib_OpenCnt == 1)
  518.     {
  519.         if (!Library_Init(LibBase))
  520.         {
  521.             Library_Exit(LibBase);
  522.             LibBase->LibNode.lib_OpenCnt--;
  523.             result = NULL;
  524.         }
  525.     }
  526.     ReleaseSemaphore(&LibBase->LockSemaphore);
  527.     return result;
  528. }
  529.  
  530. static BPTR LIBExpunge(LIB_BASE_T *LibBase)
  531. {
  532.     if (LibBase->LibNode.lib_OpenCnt == 0 && LibBase->LibSegment)
  533.     {
  534.         BPTR TempSegment = LibBase->LibSegment;
  535.         Remove((struct Node *) LibBase);
  536.         FreeMem((APTR)((ULONG)(LibBase) - (ULONG)(LibBase->LibNode.lib_NegSize)),
  537.             LibBase->LibNode.lib_NegSize + LibBase->LibNode.lib_PosSize);
  538.         return TempSegment;
  539.     }
  540.     LibBase->LibNode.lib_Flags |= LIBF_DELEXP;
  541.     return NULL;
  542. }
  543.  
  544. static BPTR LibExpunge(void)
  545. {
  546.     LIB_BASE_T *LibBase = (LIB_BASE_T *) REG_A6;
  547.     return LIBExpunge(LibBase);
  548. }
  549.  
  550. static BPTR LibClose(void)
  551. {
  552.     LIB_BASE_T *LibBase = (LIB_BASE_T *) REG_A6;
  553.     ObtainSemaphore(&LibBase->LockSemaphore);
  554.     if (LibBase->LibNode.lib_OpenCnt > 0)
  555.     {
  556.         if (--LibBase->LibNode.lib_OpenCnt == 0)
  557.         {
  558.             Library_Exit(LibBase);
  559.         }
  560.     }
  561.     ReleaseSemaphore(&LibBase->LockSemaphore);
  562.     if (LibBase->LibNode.lib_OpenCnt == 0 && (LibBase->LibNode.lib_Flags & LIBF_DELEXP))
  563.     {
  564.         return LIBExpunge(LibBase);
  565.     }
  566.     return NULL;
  567. }
  568.  
  569. #undef SysBase
  570.  
  571. static LIB_BASE_T *LibInit(LIB_BASE_T *LibBase, BPTR Segment, struct ExecBase *ExecBase)
  572. {
  573.     SysBase = ExecBase;
  574.  
  575.     LibBase->LibSegment = Segment;
  576.     LibBase->ExecBase = ExecBase;
  577.     InitSemaphore(&LibBase->LockSemaphore);
  578.     return LibBase;
  579. }
  580.  
  581. static ULONG LibVectors[] =
  582. {
  583.     FUNCARRAY_32BIT_NATIVE,
  584.     (ULONG) LibOpen,
  585.     (ULONG) LibClose,
  586.     (ULONG) LibExpunge,
  587.     (ULONG) LibNull,
  588.  
  589. /*****************************************************************************
  590. **
  591. **    function table
  592. */
  593.  
  594.     (ULONG)    libTurboFillMem,
  595.     (ULONG)    libTurboCopyMem,
  596.     (ULONG) libCreateRMHandlerA,
  597.     (ULONG) libDeleteRMHandler,
  598.     (ULONG) libAllocRenderMem,
  599.     (ULONG) libFreeRenderMem,
  600.     (ULONG) libAllocRenderVec,
  601.     (ULONG) libFreeRenderVec,
  602.     (ULONG) libCreateHistogramA,
  603.     (ULONG) libDeleteHistogram,
  604.     (ULONG) libQueryHistogram,
  605.     (ULONG) libAddRGB,
  606.     (ULONG) libAddRGBImageA,
  607.     (ULONG) libAddChunkyImageA,
  608.     (ULONG) libExtractPaletteA,
  609.     (ULONG) libRenderA,
  610.     (ULONG) libPlanar2ChunkyA,
  611.     (ULONG) libChunky2RGBA,
  612.     (ULONG) libChunky2BitMapA,
  613.     (ULONG) libCreateScaleEngineA,
  614.     (ULONG) libDeleteScaleEngine,
  615.     (ULONG) libScaleA,
  616.     (ULONG) libConvertChunkyA,
  617.     (ULONG) libCreatePenTableA,
  618.     (ULONG) libCreatePaletteA,
  619.     (ULONG) libDeletePalette,
  620.     (ULONG) libImportPaletteA,
  621.     (ULONG) libExportPaletteA,
  622.     (ULONG) libCountRGB,
  623.     (ULONG) libBestPen,
  624.     (ULONG) libFlushPalette,
  625.     (ULONG) libSortPaletteA,
  626.     (ULONG) libAddHistogramA,
  627.     (ULONG) libScaleOrdinate,
  628.     (ULONG) libCreateHistogramPointerArray,
  629.     (ULONG) libCountHistogram,
  630.     (ULONG) libCreateMapEngineA,
  631.     (ULONG) libDeleteMapEngine,
  632.     (ULONG) libMapRGBArrayA,
  633.     (ULONG) libRGBArrayDiversityA,
  634.     (ULONG) libChunkyArrayDiversityA,
  635.     (ULONG) libMapChunkyArrayA,
  636.     (ULONG) libInsertAlphaChannelA,
  637.     (ULONG) libExtractAlphaChannelA,
  638.     (ULONG) libApplyAlphaChannelA,
  639.     (ULONG) libMixRGBArrayA,
  640.     (ULONG) libAllocRenderVecClear,
  641.     (ULONG) libCreateAlphaArrayA,
  642.     (ULONG) libMixAlphaChannelA,
  643.     (ULONG) libTintRGBArrayA,
  644.     (ULONG)    libGetPaletteAttrs,
  645.     (ULONG) libRemapArrayA,
  646.     0xFFFFFFFF
  647. };
  648.  
  649. static struct LibInitStruct LibInitStruct =
  650. {
  651.     sizeof(LIB_BASE_T),
  652.     LibVectors,
  653.     NULL,
  654.     (void (*)(void)) &LibInit
  655. };
  656.  
  657.  
  658.